package seismosurfer.gui.panel;

import seismosurfer.data.SiteData;

/**
 * This AttributesPanel shows the attributes of the 
 * sites layer objects.
 *
 */
public class SiteAttributesPanel extends AttributesPanel {
    
    private static final long serialVersionUID = -1079432351935951733L;

    private String masterTableHeaders[] = {

    SITE_CODE,

    NAME_GR, NAME_EN, NAME_GR_KAPOD, POPULATION, LATITUDE, LONGITUDE,
            PREFECTURE_GR, PREFECTURE_EN, COUNTRY_NAME,

    };

    public SiteAttributesPanel(String name) {

        super(name, false);

        setMasterTableHeaders(masterTableHeaders);
        createPanel();
    }
    
    
    public void setAttributes(Object data) {        

        if (data instanceof SiteData) {
            SiteData sd = (SiteData) data;

            masterTable.setValueAt(sd.getSiteCode().trim(), 0, 0);

            masterTable.setValueAt(sd.getSiteNameGR(), 1, 0);
            masterTable.setValueAt(sd.getSiteNameEN(), 2, 0);
            masterTable.setValueAt(sd.getSiteNameGRKapod(), 3, 0);

            masterTable.setValueAt(new Integer(sd.getPopulation()), 4, 0);

            masterTable.setValueAt(new Float(sd.getSiteLatitude()), 5, 0);
            masterTable.setValueAt(new Float(sd.getSiteLongitude()), 6, 0);

            masterTable.setValueAt(sd.getPrefectureGR(), 7, 0);
            masterTable.setValueAt(sd.getPrefectureEN(), 8, 0);

            masterTable.setValueAt(sd.getCountryName(), 9, 0);

        }

    }

}
